/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.smarttmt.smartmanager.entity;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author nicolas
 */
@Entity
@Table(name = "OBJEPROD")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Objeprod.findAll", query = "SELECT o FROM Objeprod o"),
    @NamedQuery(name = "Objeprod.findByObprprod", query = "SELECT o FROM Objeprod o WHERE o.objeprodPK.obprprod = :obprprod"),
    @NamedQuery(name = "Objeprod.findByObprobje", query = "SELECT o FROM Objeprod o WHERE o.objeprodPK.obprobje = :obprobje"),
    @NamedQuery(name = "Objeprod.findByObprdesc", query = "SELECT o FROM Objeprod o WHERE o.obprdesc = :obprdesc"),
    @NamedQuery(name = "Objeprod.findByObprdeta", query = "SELECT o FROM Objeprod o WHERE o.obprdeta = :obprdeta"),
    @NamedQuery(name = "Objeprod.findByObpresta", query = "SELECT o FROM Objeprod o WHERE o.obpresta = :obpresta"),
    @NamedQuery(name = "Objeprod.findByObprauto", query = "SELECT o FROM Objeprod o WHERE o.obprauto = :obprauto"),
    @NamedQuery(name = "Objeprod.findByObprfech", query = "SELECT o FROM Objeprod o WHERE o.obprfech = :obprfech"),
    @NamedQuery(name = "Objeprod.findByObprfeuc", query = "SELECT o FROM Objeprod o WHERE o.obprfeuc = :obprfeuc"),
    @NamedQuery(name = "Objeprod.findByObprclas", query = "SELECT o FROM Objeprod o WHERE o.obprclas = :obprclas"),
    @NamedQuery(name = "Objeprod.findByObprcali", query = "SELECT o FROM Objeprod o WHERE o.obprcali = :obprcali"),
    @NamedQuery(name = "Objeprod.findByObprconc", query = "SELECT o FROM Objeprod o WHERE o.obprconc = :obprconc"),
    @NamedQuery(name = "Objeprod.findByObprmodu", query = "SELECT o FROM Objeprod o WHERE o.obprmodu = :obprmodu"),
    @NamedQuery(name = "Objeprod.findByObprvweb", query = "SELECT o FROM Objeprod o WHERE o.obprvweb = :obprvweb")})
public class Objeprod implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected ObjeprodPK objeprodPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 50)
    @Column(name = "OBPRDESC")
    private String obprdesc;
    @Size(max = 1000)
    @Column(name = "OBPRDETA")
    private String obprdeta;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "OBPRESTA")
    private String obpresta;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 6)
    @Column(name = "OBPRAUTO")
    private String obprauto;
    @Basic(optional = false)
    @NotNull
    @Column(name = "OBPRFECH")
    @Temporal(TemporalType.TIMESTAMP)
    private Date obprfech;
    @Column(name = "OBPRFEUC")
    @Temporal(TemporalType.TIMESTAMP)
    private Date obprfeuc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "OBPRCLAS")
    private String obprclas;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "OBPRCALI")
    private String obprcali;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1)
    @Column(name = "OBPRCONC")
    private String obprconc;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 2)
    @Column(name = "OBPRMODU")
    private String obprmodu;
    @Column(name = "OBPRVWEB")
    private BigInteger obprvweb;
    @OneToMany(mappedBy = "objeprod", fetch = FetchType.LAZY)
    private List<Solucion> solucionList;

    public Objeprod() {
    }

    public Objeprod(ObjeprodPK objeprodPK) {
        this.objeprodPK = objeprodPK;
    }

    public Objeprod(ObjeprodPK objeprodPK, String obprdesc, String obpresta, String obprauto, Date obprfech, String obprclas, String obprcali, String obprconc, String obprmodu) {
        this.objeprodPK = objeprodPK;
        this.obprdesc = obprdesc;
        this.obpresta = obpresta;
        this.obprauto = obprauto;
        this.obprfech = obprfech;
        this.obprclas = obprclas;
        this.obprcali = obprcali;
        this.obprconc = obprconc;
        this.obprmodu = obprmodu;
    }

    public Objeprod(String obprprod, String obprobje) {
        this.objeprodPK = new ObjeprodPK(obprprod, obprobje);
    }

    public ObjeprodPK getObjeprodPK() {
        return objeprodPK;
    }

    public void setObjeprodPK(ObjeprodPK objeprodPK) {
        this.objeprodPK = objeprodPK;
    }

    public String getObprdesc() {
        return obprdesc;
    }

    public void setObprdesc(String obprdesc) {
        this.obprdesc = obprdesc;
    }

    public String getObprdeta() {
        return obprdeta;
    }

    public void setObprdeta(String obprdeta) {
        this.obprdeta = obprdeta;
    }

    public String getObpresta() {
        return obpresta;
    }

    public void setObpresta(String obpresta) {
        this.obpresta = obpresta;
    }

    public String getObprauto() {
        return obprauto;
    }

    public void setObprauto(String obprauto) {
        this.obprauto = obprauto;
    }

    public Date getObprfech() {
        return obprfech;
    }

    public void setObprfech(Date obprfech) {
        this.obprfech = obprfech;
    }

    public Date getObprfeuc() {
        return obprfeuc;
    }

    public void setObprfeuc(Date obprfeuc) {
        this.obprfeuc = obprfeuc;
    }

    public String getObprclas() {
        return obprclas;
    }

    public void setObprclas(String obprclas) {
        this.obprclas = obprclas;
    }

    public String getObprcali() {
        return obprcali;
    }

    public void setObprcali(String obprcali) {
        this.obprcali = obprcali;
    }

    public String getObprconc() {
        return obprconc;
    }

    public void setObprconc(String obprconc) {
        this.obprconc = obprconc;
    }

    public String getObprmodu() {
        return obprmodu;
    }

    public void setObprmodu(String obprmodu) {
        this.obprmodu = obprmodu;
    }

    public BigInteger getObprvweb() {
        return obprvweb;
    }

    public void setObprvweb(BigInteger obprvweb) {
        this.obprvweb = obprvweb;
    }

    @XmlTransient
    public List<Solucion> getSolucionList() {
        return solucionList;
    }

    public void setSolucionList(List<Solucion> solucionList) {
        this.solucionList = solucionList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (objeprodPK != null ? objeprodPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Objeprod)) {
            return false;
        }
        Objeprod other = (Objeprod) object;
        if ((this.objeprodPK == null && other.objeprodPK != null) || (this.objeprodPK != null && !this.objeprodPK.equals(other.objeprodPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.smarttmt.smartmanager.entity.Objeprod[ objeprodPK=" + objeprodPK + " ]";
    }
    
}
